<!DOCTYPE html>
<html lang="en">
<link>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Return_Order_OrderItem_Detail管理</title>
    <meta name="description" content="Return_Order_OrderItem_Detail管理">
    <meta name="keywords" content="Return_Order_OrderItem_Detail管理">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">

    <!-- 引入样式/组件 -->
    <link rel="icon" href="../img/favicon.ico">
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/elementui.css"/>
    <script src="../js/vue.js"></script>
    <script src="../js/elementui.js"></script>
    <script src="../js/axios.js"></script>
    <script src="../js/util.js"></script>

<body class="hold-transition">

<div id="app">

    <div class="content-header">
        <h1>Return_Order_OrderItem_Detail管理<small>Return_Order_OrderItem_Detail管理</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>Return_Order_OrderItem_Detail管理</el-breadcrumb-item>
            <el-breadcrumb-item>Return_Order_OrderItem_Detail管理</el-breadcrumb-item>
        </el-breadcrumb>
    </div>

    <div class="app-container">
        <div class="box">

            <el-button type="primary" onclick="location.href='return_order_orderItem_list.html'">返回退货退款申请列表</el-button>

            <!-- returnOrder是退款组合表里面ReturnOrder表的变量 -->
            <p>退款编号: {{returnOrderDetail.returnOrder.id}}</p>
            <p>退款金额：{{returnOrderDetail.returnOrder.returnMoney}}</p>
            <!-- returnOrderItemList是退款组合表里面ReturnOrderItem表的变量 -->
            <el-table :data="returnOrderDetail.returnOrderItemList"
                      style="width:100%">
                <el-table-column
                                        prop="id"
                                        label="ID"
                                        width="180">
                </el-table-column>
                <el-table-column
                                        prop="title"
                                        label="标题"
                                        width="180">
                </el-table-column>
                <el-table-column
                                        prop="money"
                                        label="总金额"
                                        width="180">
                </el-table-column>

                <el-table-column

                                        label="操作"
                                        width="180">

                    <template slot-scope="scope">
                        <el-button @click="agreeRefund()" size="mini" type="primary" size="small">同意退款</el-button>
                        <el-button @click="rejectRefund()" size="mini" type="primary" size="small">拒绝退款</el-button>
                    </template>

                </el-table-column>
            </el-table>

        </div>
    </div>
</div>

<script>

    var id = getQueryString("rid");

    new Vue({
        el: "#app",
        data:{
            returnOrderDetail:{
                // returnOrder:{},
                // returnOrderItemList:[]
            }
        },
        created(){
            this.findPage();
        },
        methods:{
            rejectRefund(){ // 不带@RequestBody
                axios.get("/return/rejectRefund.do?id="+id).then(
                    res => {
                        alert("成功");
                        location.href = "return_order_orderItem_list.html";
                    }
                )
            },
            agreeRefund(){ // 不带@RequestBody
                axios.get("/return/agreeRefund.do?id="+id).then(
                    res => {
                        alert("成功");
                        location.href = "return_order_orderItem_list.html";
                    }
                )
            },
            findPage(){
                axios.get(`/return/findById.do?id=`+id).then( res=>{
                        this.returnOrderDetail = res.data;
                })
            }
        }
    })
</script>

</body>
</html>